﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
	<ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="..\Colors\Colors.xaml"/>
	</ResourceDictionary.MergedDictionaries>

    <Style x:Key="CheckRadioFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RadioButtonStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource OuterBorderBrushStyle}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="19"/>
							<ColumnDefinition Width="*"/>							
						</Grid.ColumnDefinitions>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal"/>
								<VisualState x:Name="MouseOver">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverEcllipse">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>								
								<VisualState x:Name="Disabled">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisabledEcllipse">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Pressed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverEcllipse">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
							<VisualStateGroup x:Name="CheckStates">
								<VisualState x:Name="Checked">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="CheckedEllipse">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
										</ObjectAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="CheckedEllipse">
											<EasingDoubleKeyFrame KeyTime="0" Value="7"/>
										</DoubleAnimationUsingKeyFrames>
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="CheckedEllipse">
											<EasingDoubleKeyFrame KeyTime="0" Value="7"/>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Unchecked"/>
								<VisualState x:Name="Indeterminate"/>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Grid>
							<Ellipse x:Name="BaseEcllipse" VerticalAlignment="Center" HorizontalAlignment="Center" Width="12" Height="12" Stroke="{TemplateBinding BorderBrush}">
								<Ellipse.Fill>
									<LinearGradientBrush EndPoint="0.146,0.854" StartPoint="0.854,0.146">
										<GradientStop Color="#FFDADADA" Offset="0"/>
										<GradientStop Color="#FFFDFDFD" Offset="1"/>
									</LinearGradientBrush>
								</Ellipse.Fill>
							</Ellipse>
							<Ellipse x:Name="MouseOverEcllipse" VerticalAlignment="Center" HorizontalAlignment="Center" Width="12" Height="12" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed" Opacity="0.8" Stroke="{DynamicResource ButtonCheckingColorBrush}">
								<Ellipse.RenderTransform>
									<TransformGroup>
										<ScaleTransform/>
										<SkewTransform/>
										<RotateTransform/>
										<TranslateTransform/>
									</TransformGroup>
								</Ellipse.RenderTransform>
							</Ellipse>
							<Ellipse x:Name="InnerEcllipse" VerticalAlignment="Center" HorizontalAlignment="Center" Width="8" Height="8" Stroke="#FF979393"/>
							<Ellipse x:Name="CheckedEllipse" VerticalAlignment="Center" HorizontalAlignment="Center" Width="8" Height="8" Opacity="0.7" Visibility="Collapsed" Stroke="{DynamicResource ButtonCheckingColorBrush}" Fill="{DynamicResource RadioButonCheckedBackground}"/>
							<Ellipse x:Name="DisabledEcllipse" VerticalAlignment="Center" HorizontalAlignment="Center" Width="12" Height="12" Fill="{DynamicResource GrayLightBrush}" Opacity="0.5" Visibility="Collapsed"/>
							
						</Grid>
						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0,-1,0,0" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="2"/>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="HasContent" Value="true">
							<Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
							<Setter Property="Padding" Value="4,0,0,0"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="SnapsToDevicePixels" Value="True"/>
	</Style>
</ResourceDictionary>